﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ConcreteMappersAndObjects.DomainObjects;
using DataMappers;
using ExaminationTT.Model;

namespace ExaminationTT.Control
{
    public class MapperControl
    {
        public static IEnumerable<Student> GetAllStudents()
        {
            var ls = new List<Student>();
            UnitOfWork.Current.Get<int, Student>(typeof (Student)).LoadAllInto(ls);
            return ls;
        }

        public static IEnumerable<Semester> GetAllSemesters()
        {
            var ls = new List<Semester>();
            UnitOfWork.Current.Get<int, Semester>(typeof(Semester)).LoadAllInto(ls);
            return ls;
        }
        
        public static IEnumerable<CUnit> GetAllCUnit()
        {
            var luc = new List<CUnit>();
            UnitOfWork.Current.Get<int, CUnit>(typeof(CUnit)).LoadAllInto(luc);
            return luc;
        }

        public static IEnumerable<Subscription> GetAllSubscription()
        {
            var ls = new List<Subscription>();
            UnitOfWork.Current.Get<SubscriptionKey, Subscription>(typeof(Subscription)).LoadAllInto(ls);
            return ls;
        }

        public static IEnumerable<Course> GetAllCourses()
        {
            var lc = new List<Course>();
            UnitOfWork.Current.Get<int, Course>(typeof(Course)).LoadAllInto(lc);
            return lc;
        }

        public static IEnumerable<Regime> GetAllRegimes()
        {
            var lr = new List<Regime>();
            UnitOfWork.Current.Get<int, Regime>(typeof(Regime)).LoadAllInto(lr);
            return lr;
        }

        public static IEnumerable<SClass> GetAllClasses()
        {
            var lsc = new List<SClass>();
            UnitOfWork.Current.Get<int, SClass>(typeof(SClass)).LoadAllInto(lsc);
            return lsc;
        }

        public static IEnumerable<Teacher> GetAllTeachers()
        {
            var lt = new List<Teacher>();
            UnitOfWork.Current.Get<int, Teacher>(typeof(Teacher)).LoadAllInto(lt);
            return lt;
        }

        public static IEnumerable<Room> GetAllRooms()
        {
            var lr = new List<Room>();
            UnitOfWork.Current.Get<int, Room>(typeof(Room)).LoadAllInto(lr);
            return lr;
        }

        public static IEnumerable<Exam> GetAllExams()
        {
            var le = new List<Exam>();
            UnitOfWork.Current.Get<int, Exam>(typeof(Exam)).LoadAllInto(le);
            return le;
        }

        public static IEnumerable<ExamSeason> GetAllSeasons()
        {
            var les = new List<ExamSeason>();
            UnitOfWork.Current.Get<int, ExamSeason>(typeof(ExamSeason)).LoadAllInto(les);
            return les;
        }

        public static IEnumerable<IRoomExam> GetAllRoomExams()
        {
            var lre = new List<RoomExam>();
            UnitOfWork.Current.Get<RoomExamKey, RoomExam>(typeof(RoomExam)).LoadAllInto(lre);
            return lre;
        }
    }
}
